﻿using System;

namespace MapleLeaf.Pay.Trade {

    public class TradeAuthPaymentRequest : TradeBuildRequest {

        public string Authcode { get; set; }


        public static TradePayway AuthcodeGetTradePayway(string authcode) {
            if (!string.IsNullOrEmpty(authcode) && authcode.Length >= 16 && authcode.Length <= 24 && int.TryParse(authcode.Substring(0, 2), out int num)) {
                if (authcode.Length == 18 && num >= 10 && num <= 15) {
                    return TradePayway.微信;
                }
                if (authcode.Length == 19 && num == 62) {
                    return TradePayway.云闪付;
                }
                if (num >= 25 && num <= 30) {
                    return TradePayway.支付宝;
                }
            }
            return TradePayway.未知;
        }
    }
}
